.Switch {
  position: relative;
  display: flex;
  appearance: none;
  border: 0;
  margin: 0;
  padding: 1px;
  width: 2.5rem;
  height: 1.5rem;
  border-radius: 1.5rem;
  outline: 1px solid;
  outline-offset: -1px;
  background-color: transparent;
  background-image: linear-gradient(to right, var(--color-gray-700) 35%, var(--color-gray-200) 65%);
  background-size: 6.5rem 100%;
  background-position-x: 100%;
  background-repeat: no-repeat;
  transition-property: background-position, box-shadow;
  transition-timing-function: cubic-bezier(0.26, 0.75, 0.38, 0.45);
  transition-duration: 125ms;

  &:active {
    background-color: var(--color-gray-100);
  }

  &[data-checked] {
    background-position-x: 0%;
  }

  &[data-checked]:active {
    background-color: var(--color-gray-500);
  }

  @media (prefers-color-scheme: light) {
    box-shadow: var(--color-gray-200) 0 1.5px 2px inset;
    outline-color: var(--color-gray-200);
  }

  @media (prefers-color-scheme: dark) {
    box-shadow: rgb(0 0 0 / 75%) 0 1.5px 2px inset;
    outline-color: rgb(255 255 255 / 15%);
    background-image: linear-gradient(
      to right,
      var(--color-gray-500) 35%,
      var(--color-gray-200) 65%
    );

    &[data-checked] {
      box-shadow: none;
    }
  }

  &:focus-visible {
    &::before {
      content: '';
      inset: 0;
      position: absolute;
      border-radius: inherit;
      outline: 2px solid var(--color-blue);
      outline-offset: 2px;
    }
  }
}

.Thumb {
  aspect-ratio: 1 / 1;
  height: 100%;
  border-radius: 100%;
  background-color: white;
  transition: translate 150ms ease;

  &[data-checked] {
    translate: 1rem 0;
  }

  @media (prefers-color-scheme: light) {
    box-shadow:
      0 0 1px 1px var(--color-gray-100),
      0 1px 1px var(--color-gray-100),
      1px 2px 4px -1px var(--color-gray-100);
  }

  @media (prefers-color-scheme: dark) {
    box-shadow:
      0 0 1px 1px rgb(0 0 0 / 25%),
      0 1px 1px rgb(0 0 0 / 25%),
      1px 2px 4px -1px rgb(0 0 0 / 25%);
  }
}
